from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

import sys

sys.path.append(r'..')
from web_base.base_page import BasePage
from page_object.login_page import LoginPage


class LocationPage(BasePage):
    url = r'/bsams/front/asset_storage/asset_storage_list.do'

    query_status_loc = (By.ID, 'status')
    query_title_loc = (By.ID, 'title')
    query_ok_loc = (By.CLASS_NAME, 'search_button')

    def query(self,status, title):
        self.open()
        self.ele_select(self.query_status_loc, status)
        self.ele_clear(self.query_title_loc)
        self.input_ele(self.query_title_loc, title)
        self.ele_click(self.query_ok_loc)
        sleep(2)

if __name__ == '__main__':
    status = '废弃'
    title = '行政库房'


    chrome_location = r'D:\RJCS\谷歌浏览器内网通紫域和驱动安装\chrome-win\chrome.exe'
    options = webdriver.ChromeOptions()
    options.binary_location = chrome_location

    driver = webdriver.Chrome(options=options)

    login_page = LoginPage(driver)
    login_page.login()

    location_page = LocationPage(driver)
    location_page.query(status,title)